<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>Spring ConfigurationClassParser | flyingzc's blog</title><meta name="author" content="flyingzc"><meta name="copyright" content="flyingzc"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="Spring ConfigurationClassParser123456789101112131415161718192021- ConfigurationClassPostProcessor.processConfigBeanDefinitions()- 1.获取 registry 中的 beanDefinitionNames- 2.遍历beanDefinitionNames判断beanDef">
<meta property="og:type" content="article">
<meta property="og:title" content="Spring ConfigurationClassParser">
<meta property="og:url" content="https://flyingzc.github.io/articles/spring/spring10-ConfigurationClassParser.html">
<meta property="og:site_name" content="flyingzc&#39;s blog">
<meta property="og:description" content="Spring ConfigurationClassParser123456789101112131415161718192021- ConfigurationClassPostProcessor.processConfigBeanDefinitions()- 1.获取 registry 中的 beanDefinitionNames- 2.遍历beanDefinitionNames判断beanDef">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://flyingzc.github.io/images/zc-icon.jpeg">
<meta property="article:published_time" content="2020-06-12T16:00:00.000Z">
<meta property="article:modified_time" content="2025-01-21T01:51:41.214Z">
<meta property="article:author" content="flyingzc">
<meta property="article:tag" content="Spring">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://flyingzc.github.io/images/zc-icon.jpeg"><script type="application/ld+json">{
  "@context": "https://schema.org",
  "@type": "BlogPosting",
  "headline": "Spring ConfigurationClassParser",
  "url": "https://flyingzc.github.io/articles/spring/spring10-ConfigurationClassParser.html",
  "image": "https://flyingzc.github.io/images/zc-icon.jpeg",
  "datePublished": "2020-06-12T16:00:00.000Z",
  "dateModified": "2025-01-21T01:51:41.214Z",
  "author": [
    {
      "@type": "Person",
      "name": "flyingzc",
      "url": "https://flyingzc.github.io/"
    }
  ]
}</script><link rel="shortcut icon" href="/images/zc-icon.jpeg"><link rel="canonical" href="https://flyingzc.github.io/articles/spring/spring10-ConfigurationClassParser.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><meta name="google-site-verification" content="DentpX3LnP_WNgEeFnNIcTZZky-Bby-zL-uI_9GqTAw"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css"><script>
    (() => {
      
    const saveToLocal = {
      set: (key, value, ttl) => {
        if (!ttl) return
        const expiry = Date.now() + ttl * 86400000
        localStorage.setItem(key, JSON.stringify({ value, expiry }))
      },
      get: key => {
        const itemStr = localStorage.getItem(key)
        if (!itemStr) return undefined
        const { value, expiry } = JSON.parse(itemStr)
        if (Date.now() > expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return value
      }
    }

    window.btf = {
      saveToLocal,
      getScript: (url, attr = {}) => new Promise((resolve, reject) => {
        const script = document.createElement('script')
        script.src = url
        script.async = true
        Object.entries(attr).forEach(([key, val]) => script.setAttribute(key, val))
        script.onload = script.onreadystatechange = () => {
          if (!script.readyState || /loaded|complete/.test(script.readyState)) resolve()
        }
        script.onerror = reject
        document.head.appendChild(script)
      }),
      getCSS: (url, id) => new Promise((resolve, reject) => {
        const link = document.createElement('link')
        link.rel = 'stylesheet'
        link.href = url
        if (id) link.id = id
        link.onload = link.onreadystatechange = () => {
          if (!link.readyState || /loaded|complete/.test(link.readyState)) resolve()
        }
        link.onerror = reject
        document.head.appendChild(link)
      }),
      addGlobalFn: (key, fn, name = false, parent = window) => {
        if (!false && key.startsWith('pjax')) return
        const globalFn = parent.globalFn || {}
        globalFn[key] = globalFn[key] || {}
        globalFn[key][name || Object.keys(globalFn[key]).length] = fn
        parent.globalFn = globalFn
      }
    }
  
      
      const activateDarkMode = () => {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      const activateLightMode = () => {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }

      btf.activateDarkMode = activateDarkMode
      btf.activateLightMode = activateLightMode

      const theme = saveToLocal.get('theme')
    
          theme === 'dark' ? activateDarkMode() : theme === 'light' ? activateLightMode() : null
        
      
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        document.documentElement.classList.toggle('hide-aside', asideStatus === 'hide')
      }
    
      
    const detectApple = () => {
      if (/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)) {
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
  
    })()
  </script><script async="async" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><script>(adsbygoogle = window.adsbygoogle || []).push({
  google_ad_client: '',
  enable_page_level_ads: 'true'
});</script><script>const GLOBAL_CONFIG = {
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  highlight: {"plugin":"highlight.js","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false,"highlightFullpage":false,"highlightMacStyle":false},
  copy: {
    success: '复制成功',
    error: '复制失败',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  dateSuffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'null',
  Snackbar: undefined,
  infinitegrid: {
    js: 'https://cdn.jsdelivr.net/npm/@egjs/infinitegrid/dist/infinitegrid.min.js',
    buttonText: '加载更多'
  },
  isPhotoFigcaption: false,
  islazyloadPlugin: false,
  isAnchor: false,
  percent: {
    toc: true,
    rightside: false,
  },
  autoDarkmode: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'Spring ConfigurationClassParser',
  isHighlightShrink: false,
  isToc: true,
  pageType: 'post'
}</script><link rel="stylesheet" href="/self/github-dark.css"><meta name="generator" content="Hexo 7.0.0"></head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img text-center"><img src="/images/zc-icon.jpeg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data text-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">84</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">36</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">29</div></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于我</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header"><nav id="nav"><span id="blog-info"><a class="nav-site-title" href="/"><span class="site-name">flyingzc's blog</span></a><a class="nav-page-title" href="/"><span class="site-name">Spring ConfigurationClassParser</span></a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于我</span></a></div></div><div id="toggle-menu"><span class="site-page"><i class="fas fa-bars fa-fw"></i></span></div></div></nav><div id="post-info"><h1 class="post-title">Spring ConfigurationClassParser</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2020-06-12T16:00:00.000Z" title="发表于 2020-06-13 00:00:00">2020-06-13</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2025-01-21T01:51:41.214Z" title="更新于 2025-01-21 09:51:41">2025-01-21</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/Spring/">Spring</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title=""><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">浏览量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="container post-content" id="article-container"><h1 id="Spring-ConfigurationClassParser"><a href="#Spring-ConfigurationClassParser" class="headerlink" title="Spring ConfigurationClassParser"></a>Spring ConfigurationClassParser</h1><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><code class="hljs plaintext">- ConfigurationClassPostProcessor.processConfigBeanDefinitions()<br>- 1.获取 registry 中的 beanDefinitionNames<br>- 2.遍历beanDefinitionNames判断beanDefinition 是否是 @Configuration 配置类,若是则添加到 configCandidates 集合中<br>- 3.configCandidates根据Order排序<br>- 4.创建ConfigurationClassParser,配置类解析器<br>- 5.遍历configCandidates,调用parser.parse()进行配置类解析<br>    - ConfigurationClassParser.parse()<br>    - 1.遍历configCandidates,获取当前的beanDefinition<br>    - 2.根据不同类型的beanDefinition,调用不同入参的parse()方法<br>        - ConfigurationClassParser.processConfigurationClass()<br>        - 1.是否需要跳过 @Conditional<br>        - 2.循环递归调用doProcessConfigurationClass()方法,处理配置类和父类,直到没有父类时,方法返回null,结束循环<br>            - ConfigurationClassParser.doProcessConfigurationClass()<br>            - 1.判断是否含有 @Component 注解,首先递归处理任何成员(嵌套)类<br>            - 2.若有PropertySources注解,循环处理 @PropertySource 注解<br>            - 3.若有@ComponentScan注解,处理 @ComponentScan 注解<br>            - 4.处理 @Import 注解<br>            - 5.若有 @ImportResource 注解,处理 @ImportResource 注解<br>            - 6.处理 @Bean 注解的方法<br>            - 7.如果有父类,获取父类名,外层循环会继续调用该方法解析父类.没有父类返回null,结束循环<br>- 6.loadBeanDefinitions() 把前面解析出来的对象注册到容器中<br></code></pre></td></tr></table></figure>

<h2 id="ConfigurationClassParser-doProcessConfigurationClass"><a href="#ConfigurationClassParser-doProcessConfigurationClass" class="headerlink" title="ConfigurationClassParser.doProcessConfigurationClass()"></a>ConfigurationClassParser.doProcessConfigurationClass()</h2><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br></pre></td><td class="code"><pre><code class="hljs java"><span class="hljs-comment">/** 通过解析源类中的 注解、成员 和 方法,创建 ConfigurationClass</span><br><span class="hljs-comment">    * Apply processing and build a complete &#123;<span class="hljs-doctag">@link</span> ConfigurationClass&#125; by reading the</span><br><span class="hljs-comment">    * annotations, members and methods from the source class. This method can be called</span><br><span class="hljs-comment">    * multiple times as relevant sources are discovered.</span><br><span class="hljs-comment">    * <span class="hljs-doctag">@param</span> configClass the configuration class being build</span><br><span class="hljs-comment">    * <span class="hljs-doctag">@param</span> sourceClass a source class</span><br><span class="hljs-comment">    * <span class="hljs-doctag">@return</span> the superclass, or &#123;<span class="hljs-doctag">@code</span> null&#125; if none found or previously processed</span><br><span class="hljs-comment">    */</span><br><span class="hljs-meta">@Nullable</span><br><span class="hljs-keyword">protected</span> <span class="hljs-keyword">final</span> SourceClass <span class="hljs-title function_">doProcessConfigurationClass</span><span class="hljs-params">(ConfigurationClass configClass, SourceClass sourceClass)</span><br>        <span class="hljs-keyword">throws</span> IOException &#123;<br><br>    <span class="hljs-keyword">if</span> (configClass.getMetadata().isAnnotated(Component.class.getName())) &#123; <span class="hljs-comment">// 含有 @Component 注解</span><br>        <span class="hljs-comment">// Recursively process any member (nested) classes first.首先递归处理任何成员(嵌套)类</span><br>        processMemberClasses(configClass, sourceClass);<br>    &#125;<br><br>    <span class="hljs-comment">// Process any @PropertySource annotations. 处理 @PropertySource</span><br>    <span class="hljs-keyword">for</span> (AnnotationAttributes propertySource : AnnotationConfigUtils.attributesForRepeatable(<br>            sourceClass.getMetadata(), PropertySources.class,<br>            org.springframework.context.annotation.PropertySource.class)) &#123;<br>        <span class="hljs-keyword">if</span> (<span class="hljs-built_in">this</span>.environment <span class="hljs-keyword">instanceof</span> ConfigurableEnvironment) &#123;<br>            processPropertySource(propertySource);<br>        &#125;<br>        <span class="hljs-keyword">else</span> &#123;<br>            logger.info(<span class="hljs-string">&quot;Ignoring @PropertySource annotation on [&quot;</span> + sourceClass.getMetadata().getClassName() +<br>                    <span class="hljs-string">&quot;]. Reason: Environment must implement ConfigurableEnvironment&quot;</span>);<br>        &#125;<br>    &#125;<br><br>    <span class="hljs-comment">// Process any @ComponentScan annotations. 处理 @ComponentScan 注解</span><br>    Set&lt;AnnotationAttributes&gt; componentScans = AnnotationConfigUtils.attributesForRepeatable(<br>            sourceClass.getMetadata(), ComponentScans.class, ComponentScan.class);<br>    <span class="hljs-keyword">if</span> (!componentScans.isEmpty() &amp;&amp;<br>            !<span class="hljs-built_in">this</span>.conditionEvaluator.shouldSkip(sourceClass.getMetadata(), ConfigurationPhase.REGISTER_BEAN)) &#123;<br>        <span class="hljs-keyword">for</span> (AnnotationAttributes componentScan : componentScans) &#123;<br>            <span class="hljs-comment">// The config class is annotated with @ComponentScan -&gt; perform the scan immediately</span><br>            Set&lt;BeanDefinitionHolder&gt; scannedBeanDefinitions =<br>                    <span class="hljs-built_in">this</span>.componentScanParser.parse(componentScan, sourceClass.getMetadata().getClassName());<br>            <span class="hljs-comment">// Check the set of scanned definitions for any further config classes and parse recursively if needed</span><br>            <span class="hljs-keyword">for</span> (BeanDefinitionHolder holder : scannedBeanDefinitions) &#123;<br>                <span class="hljs-type">BeanDefinition</span> <span class="hljs-variable">bdCand</span> <span class="hljs-operator">=</span> holder.getBeanDefinition().getOriginatingBeanDefinition();<br>                <span class="hljs-keyword">if</span> (bdCand == <span class="hljs-literal">null</span>) &#123;<br>                    bdCand = holder.getBeanDefinition();<br>                &#125;<br>                <span class="hljs-keyword">if</span> (ConfigurationClassUtils.checkConfigurationClassCandidate(bdCand, <span class="hljs-built_in">this</span>.metadataReaderFactory)) &#123; <span class="hljs-comment">// 判断解析获取的 BeanDefinition 中 是否有配置类.也就是说只要有 @Configuration、@Component、@ComponentScan、@Import、@ImportResource 和 @Bean 中的其中一个注解</span><br>                    parse(bdCand.getBeanClassName(), holder.getBeanName()); <span class="hljs-comment">// 如果有配置类,递归调用,解析该配置类</span><br>                &#125;<br>            &#125;<br>        &#125;<br>    &#125;<br><br>    <span class="hljs-comment">// Process any @Import annotations. 处理 @Import 注解</span><br>    processImports(configClass, sourceClass, getImports(sourceClass), <span class="hljs-literal">true</span>);<br><br>    <span class="hljs-comment">// Process any @ImportResource annotations. 处理 @ImportResource 注解</span><br>    <span class="hljs-type">AnnotationAttributes</span> <span class="hljs-variable">importResource</span> <span class="hljs-operator">=</span><br>            AnnotationConfigUtils.attributesFor(sourceClass.getMetadata(), ImportResource.class);<br>    <span class="hljs-keyword">if</span> (importResource != <span class="hljs-literal">null</span>) &#123;<br>        String[] resources = importResource.getStringArray(<span class="hljs-string">&quot;locations&quot;</span>);<br>        Class&lt;? <span class="hljs-keyword">extends</span> <span class="hljs-title class_">BeanDefinitionReader</span>&gt; readerClass = importResource.getClass(<span class="hljs-string">&quot;reader&quot;</span>);<br>        <span class="hljs-keyword">for</span> (String resource : resources) &#123;<br>            <span class="hljs-type">String</span> <span class="hljs-variable">resolvedResource</span> <span class="hljs-operator">=</span> <span class="hljs-built_in">this</span>.environment.resolveRequiredPlaceholders(resource);<br>            configClass.addImportedResource(resolvedResource, readerClass);<br>        &#125;<br>    &#125;<br><br>    <span class="hljs-comment">// Process individual @Bean methods. 处理 @Bean 方法</span><br>    Set&lt;MethodMetadata&gt; beanMethods = retrieveBeanMethodMetadata(sourceClass); <span class="hljs-comment">// 检索 @Bean 方法</span><br>    <span class="hljs-keyword">for</span> (MethodMetadata methodMetadata : beanMethods) &#123;<br>        configClass.addBeanMethod(<span class="hljs-keyword">new</span> <span class="hljs-title class_">BeanMethod</span>(methodMetadata, configClass)); <span class="hljs-comment">// 创建 BeanMethod,添加到 beanMethods</span><br>    &#125;<br><br>    <span class="hljs-comment">// Process default methods on interfaces</span><br>    processInterfaces(configClass, sourceClass);<br><br>    <span class="hljs-comment">// Process superclass, if any. 如果有父类,则解析父类</span><br>    <span class="hljs-keyword">if</span> (sourceClass.getMetadata().hasSuperClass()) &#123;<br>        <span class="hljs-type">String</span> <span class="hljs-variable">superclass</span> <span class="hljs-operator">=</span> sourceClass.getMetadata().getSuperClassName();<br>        <span class="hljs-keyword">if</span> (superclass != <span class="hljs-literal">null</span> &amp;&amp; !superclass.startsWith(<span class="hljs-string">&quot;java&quot;</span>) &amp;&amp;<br>                !<span class="hljs-built_in">this</span>.knownSuperclasses.containsKey(superclass)) &#123;<br>            <span class="hljs-built_in">this</span>.knownSuperclasses.put(superclass, configClass);<br>            <span class="hljs-comment">// Superclass found, return its annotation metadata and recurse</span><br>            <span class="hljs-keyword">return</span> sourceClass.getSuperClass(); <span class="hljs-comment">// 不返回null,外层循环调用</span><br>        &#125;<br>    &#125;<br><br>    <span class="hljs-comment">// No superclass -&gt; processing is complete</span><br>    <span class="hljs-keyword">return</span> <span class="hljs-literal">null</span>; <span class="hljs-comment">// 循环出口.没有父类,处理完成,返回null,外层结束循环</span><br>&#125;<br></code></pre></td></tr></table></figure>
<link rel="stylesheet" href="https://fastly.jsdelivr.net/npm/markmap-toolbar@0.18.10/dist/style.css"><script src="https://fastly.jsdelivr.net/npm/d3@7"></script><script src="https://fastly.jsdelivr.net/npm/markmap-view@0.18.10"></script><script src="https://fastly.jsdelivr.net/npm/markmap-toolbar@0.18.10"></script>
<link rel="stylesheet" href="/css/markmap.css">

<script src="/js/markmap.js"></script>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta"><i class="fas fa-circle-user fa-fw"></i>文章作者: </span><span class="post-copyright-info"><a href="https://flyingzc.github.io">flyingzc</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta"><i class="fas fa-square-arrow-up-right fa-fw"></i>文章链接: </span><span class="post-copyright-info"><a href="https://flyingzc.github.io/articles/spring/spring10-ConfigurationClassParser.html">https://flyingzc.github.io/articles/spring/spring10-ConfigurationClassParser.html</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta"><i class="fas fa-circle-exclamation fa-fw"></i>版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来源 <a href="https://flyingzc.github.io" target="_blank">flyingzc's blog</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/Spring/">Spring</a></div><div class="post-share"><div class="social-share" data-image="/images/zc-icon.jpeg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><a class="pagination-related" href="/articles/spring/spring03-transaction.html" title="Spring 事务实现"><div class="cover" style="background: var(--default-bg-color)"></div><div class="info text-center"><div class="info-1"><div class="info-item-1"><i class="far fa-calendar-alt fa-fw"></i> 2023-12-28</div><div class="info-item-2">Spring 事务实现</div></div><div class="info-2"><div class="info-item-1">Spring 事务实现Spring 事务使用123456789101112131415161718192021222324@Transactional注解配置项    事务传播行为        PROPAGATION_REQUIRED            当前方法必须在事务中，没有就创建，有就加入。        PROPAGATION_SUPPORTS            有事务就加入，没有就以非事务方式执行。        PROPAGATION_MANDATORY            有事务就加入，没有就抛出异常。        PROPAGATION_REQUIRES_NEW            永远创建新事务执行，之前若有事务则挂起之前的事务。        PROPAGATION_NOT_SUPPORTED            以非事务方式执行。之前若有事务则挂起之前的事务。        PROPAGATION_NEVER            以非事务方式执行。之前若有事务则抛出异常。        PROPAGATION_NESTED       ...</div></div></div></a></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info text-center"><div class="avatar-img"><img src="/images/zc-icon.jpeg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info-name">flyingzc</div><div class="author-info-description">不积跬步无以至千里<br/>不积小流无以成江海</div><div class="site-data"><a href="/archives/"><div class="headline">文章</div><div class="length-num">84</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">36</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">29</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/FlyingZC"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons"><a class="social-icon" href="https://github.com/FlyingZC" target="_blank" title="Github"><i class="fab fa-github" style="color: #24292e;"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">FlyingZC's Blog</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#Spring-ConfigurationClassParser"><span class="toc-number">1.</span> <span class="toc-text">Spring ConfigurationClassParser</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#ConfigurationClassParser-doProcessConfigurationClass"><span class="toc-number">1.1.</span> <span class="toc-text">ConfigurationClassParser.doProcessConfigurationClass()</span></a></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/articles/ignite/ignite03-transaction-begin.html" title="Apache Ignite 开启事务执行流程">Apache Ignite 开启事务执行流程</a><time datetime="2025-10-10T16:00:00.000Z" title="发表于 2025-10-11 00:00:00">2025-10-11</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/articles/ignite/ignite02-transaction.html" title="Apache Ignite 分布式事务原理">Apache Ignite 分布式事务原理</a><time datetime="2025-09-17T16:00:00.000Z" title="发表于 2025-09-18 00:00:00">2025-09-18</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/articles/ignite/ignite01-build.html" title="Apache Ignite IDEA 环境搭建">Apache Ignite IDEA 环境搭建</a><time datetime="2025-09-10T16:00:00.000Z" title="发表于 2025-09-11 00:00:00">2025-09-11</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/articles/druid/druid01-resultset-leak.html" title="ShardingSphere JDBC 使用 Druid 连接池 ResultSet 内存泄露分析">ShardingSphere JDBC 使用 Druid 连接池 ResultSet 内存泄露分析</a><time datetime="2025-06-30T16:00:00.000Z" title="发表于 2025-07-01 00:00:00">2025-07-01</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/articles/jmeter/jmeter01-shardingsphere.html" title="Jmeter 压测 ShardingSphere">Jmeter 压测 ShardingSphere</a><time datetime="2025-06-30T16:00:00.000Z" title="发表于 2025-07-01 00:00:00">2025-07-01</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2025 By flyingzc</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="日间和夜间模式切换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside-config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><div class="js-pjax"></div><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>